package com.nq.utils.smsUtil;

import cn.hutool.http.HttpUtil;

import lombok.val;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 对接海外短信
 */
@Component
public class AbroadSmsUtil {
    private static final Logger log = LoggerFactory.getLogger(AbroadSmsUtil.class);

    @Value("${abroad.sms.url}")
    private String url;

    @Value("${abroad.sms.appkey}")
    private String appkey;

    @Value("${abroad.sms.appsecret}")
    private String appsecret;


    public String sendSms(String phone, String msg) {
        String body = HttpUtil.createGet(url)
                .form("appkey", appkey)
                .form("appsecret", appsecret)
                .form("phone", "+" + phone)
                .form("msg", msg)
                .execute()
                .body();
        return body;
    }

}
